package org.jeecg.modules.tankerRegistration.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.tankerRegistration.entity.TankerRegistration;
import org.jeecg.modules.tankerRegistration.mapper.TankerRegistrationMapper;
import org.jeecg.modules.tankerRegistration.service.ITankerRegistrationService;
import org.springframework.stereotype.Service;

/**
 * @Description: 罐车登记表
 * @Author: jeecg-boot
 * @Date:   2024-07-05
 * @Version: V1.0
 */
@Service
public class TankerRegistrationServiceImpl extends ServiceImpl<TankerRegistrationMapper, TankerRegistration> implements ITankerRegistrationService {

    @Override
    public TankerRegistration getLastByPlateNo(String plateNo) {
        LambdaQueryWrapper<TankerRegistration> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(TankerRegistration::getPlateNo, plateNo);
        wrapper.orderByDesc(TankerRegistration::getCreateTime);
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }
}
